 function SDX_GroupByDrager(_RootObject)
 {
  this.RootObject = _RootObject;
  this.ID="SDXHM_GroupBy";
  this.Visible=true;
  this.TabLinkClass="";
  this.TabClass="";
  this.Show=Show;
  this.SelectGroupBy=SelectGroupBy;
  this.ClearGroupBy=ClearGroupBy;
  this.DeleteGroupBy=DeleteGroupBy;
  this.SelectedGroupBy=null;
  this.HTMLOutPut=HTMLOutPut;
  this.HTMLOutPuts=HTMLOutPuts;
  function Show(bShow)
  {
   document.getElementById(this.ID).style.display=(bShow?'block':'none');
  }
  function SelectGroupBy(nGroupByIndex)
  {
   this.ClearGroupBy()
   this.SelectedGroupBy=nGroupByIndex
   this.RootObject.Styles.SetFont(document.getElementById(this.ID + "_" + this.RootObject.Name + "_Header_" + nGroupByIndex).style,this.RootObject.Styles.SelectedItemStyle)
  }
  function ClearGroupBy()
  {
   if(this.SelectedGroupBy!=null)
   {
    this.RootObject.Styles.RemoveFonts(document.getElementById(this.ID + "_" + this.RootObject.Name + "_Header_" + this.SelectedGroupBy).style)
    this.RootObject.GroupByDrager.SelectedGroupBy=null;
   }
  }
  function DeleteGroupBy()
  {
   if(this.SelectedGroupBy==null)return
   var nGroupByColumnIndex=this.RootObject.GroupBy.Columns[this.SelectedGroupBy]
   var aDue=this.RootObject.GroupBy.Columns
   this.RootObject.GroupBy.Columns=new Array()
   for(var nX=0;nX<aDue.length;nX++)
    if(aDue[nX]!=nGroupByColumnIndex)
    {
     this.RootObject.GroupBy.InsertColumn(this.RootObject.Columns.Columns[aDue[nX]].Key)
    }
   this.ClearGroupBy();
   this.RootObject.Initialize()
  }
  function HTMLOutPut()
  {
   var sHTMLOutPut="<table width=100% " + this.RootObject.Styles.GetStyleHTML(this.RootObject.Styles.GroupByTableStyle) + " >"
   for(var nX=0;nX<this.RootObject.GroupBy.Columns.length;nX++)
   {
     sHTMLOutPut+="<tr>" +
                  (nX>0?"<td colspan=" + nX + "></td>":"") +
                  " <td  " + this.RootObject.Styles.GetStyleHTML(this.RootObject.Styles.GroupByTableItemStyle) + " id=\"" + this.ID + "_" + this.RootObject.Name + "_Header_" + nX + "\" " +
                  " onclick=\"" + this.RootObject.Name + ".GroupByDrager.SelectGroupBy(" + nX + ")\"" +
                  " onmouseup=\"" + this.RootObject.Name + ".Events.Drag.HeaderToGroupBy()\">&nbsp;" +
                  this.RootObject.Columns.Columns[this.RootObject.GroupBy.Columns[nX]].Header + "</td>" +
                  (nX<this.RootObject.GroupBy.Columns.length-1?"<td colspan=" + (this.RootObject.GroupBy.Columns.length-nX) + "></td>":"") +
                  "</tr>"
   }
   if(this.RootObject.GroupBy.Columns.length==0)
     sHTMLOutPut+="<tr>" +
                  "<td " +
                  " onmouseup=\"" + this.RootObject.Name + ".Events.Drag.HeaderToGroupBy()\">" +
                  "&nbsp;Drag Here...</td>" +
                  "</tr>"
   sHTMLOutPut+="</table>"
   return sHTMLOutPut;
  }
  function HTMLOutPuts()
  {
   return this.HTMLOutPut() ;
  }
 }
